home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.mactech.com 2010
/
ftp.mactech.com.tar
/
ftp.mactech.com
/
challenge
/
12.04-Apr96
/
LifeTestCode DR3.sit
/
Life TestCode DR3
/
LifeScramble.c
< prev
next >
Wrap
Text File
|
1996-04-01
|
1KB
|
45 lines
/* LifeScramble.c */
/* ©Ludovic Nicolle 1996 */
/*
this file contain the code of the function responsible for
bitmap initialization.
The following are true:
- the GrafPort pointed by inputCellsPort exists and the BitMap has
already been allocated.
- GrafPort has also been erased so the world is empty.
- GetPort/SetPort is done by the caller, so InitCellsPort don't
have to bother if it doesn't change the port.
*/
#include "LifeScramble.h"
void InitCellsPort(GrafPtr inputCellsPort)
{
/* sample initialization draws small ovals in the bitmap */
/* replace with your own code if needed */
Point mybounds;
short i, limit;
Rect drawRect;
limit = Random() & 0xFF;
mybounds = botRight(inputCellsPort->portBits.bounds);
for(i = 0; i < limit; i++)
{
drawRect.top = (Random() & 0x7FFF) % mybounds.v;
drawRect.left = (Random() & 0x7FFF) % mybounds.h;
drawRect.bottom = drawRect.top + (Random() & 0x0F);
drawRect.right = drawRect.left + (Random() & 0x0F);
InvertOval(&drawRect);
}
}